"""小米网站登录"""

import requests
import hashlib

url = 'https://account.xiaomi.com/pass/serviceLoginAuth2'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
}

password = input('请输入密码：')
password = hashlib.md5(password.encode()).hexdigest().upper()
data = {
'bizDeviceType':'',
'needTheme':'false',
'theme':'',
'showActiveX':'false',
'serviceParam:{"checkSafePhone":false,"checkSafeAddress":false,"lsrp_score"':'0.0}',
'callback:http':'//order.mi.com/login/callback?followup=https%3A%2F%2Fwww.mi.com%2F%3Fg_utm%3DThirdparty.Baidu1.L1.3.ProductUnion&sign=MGQ2ZGFlMTBiNmJlZWMwNTY4YmE1MjUwYTMzNTFmNjMzODNmYmExYw',
'qs':'%3Fcallback%3Dhttp%253A%252F%252Forder.mi.com%252Flogin%252Fcallback%253Ffollowup%253Dhttps%25253A%25252F%25252Fwww.mi.com%25252F%25253Fg_utm%25253DThirdparty.Baidu1.L1.3.ProductUnion%2526sign%253DMGQ2ZGFlMTBiNmJlZWMwNTY4YmE1MjUwYTMzNTFmNjMzODNmYmExYw%252C%252C%26sid%3Dmi_eshop%26_qrsize%3D180',
'sid':'mi_eshop',
'_sign':'jlL5/lelFals2DF6qfPiKJ9zwZM=',
'user':'1269658737',
'cc':'+86',
'hash':password,
'_json':'true',
'policyName':'miaccount',
'captCode':''
}

response = requests.post(url,headers=headers,data=data)
print(response.content.decode())